﻿using Kw.Combinatorics;
using System;

namespace Kw.CombinatoricsExamples
{
    class PermutationExample05
    {
        static void Main ()
        {
            int width = 4;
            long rank = 2;

            Permutation pn = new Permutation (width, rank);

            // Elements may be accessed using the default iterator:

            foreach (int element in pn)
                Console.Write ((char) ('A' + element));

            Console.WriteLine ("\n");

            // Elements may be accessed using the index operator:

            for (int i = 0; i < pn.Width; ++i)
                Console.WriteLine ("Element at {0} is {1}", i, pn[i]);
        }

        /* Output:

        ACBD

        Element at 0 is 0
        Element at 1 is 2
        Element at 2 is 1
        Element at 3 is 3

        */
    }
}
